package com.cn.kabalifemerchants.ui.user.adapter;

import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.cn.kabalifemerchants.R;
import com.cn.kabalifemerchants.ui.user.bean.CashListBean;
import com.cn.kabalifemerchants.utils.GetJsonDataUtil;

import java.util.List;

/**
 * Created by 晓林 on 2020/10/21.
 * function:
 */
public class TiXianAdapter extends BaseQuickAdapter<CashListBean.ResultBean.DataBean, BaseViewHolder> {
    public TiXianAdapter(int layoutResId, @Nullable List<CashListBean.ResultBean.DataBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(@NonNull BaseViewHolder helper, CashListBean.ResultBean.DataBean item) {
        helper.setText(R.id.tv_money, item.getMoney())
                .setText(R.id.tv_status, item.getStatus_name())
                .setText(R.id.tvcreated_at, item.getCreated_at());
        TextView tvx = helper.getView(R.id.tv_status_x);
        ImageView imgStart = helper.getView(R.id.img_start);

        if (item.getStatus() == 2 || item.getStatus() == 3) {
            tvx.setBackgroundColor(this.mContext.getResources().getColor(R.color.main_color));
            imgStart.setImageResource(R.drawable.check_true);
        } else {
            tvx.setBackgroundColor(this.mContext.getResources().getColor(R.color.text_dddddd));
            imgStart.setImageResource(R.drawable.check_false);
        }

    }
}
